package GUI;

import javax.swing.table.DefaultTableModel;
import javax.swing.*;
import java.awt.*;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


/**
 * This class creates instance of TardinessReportGuiOutput 	
 * to display when needed 
 * @author Natali
 *
 */
public class TardinessReport_GUI extends JPanel {
	
	private static final long serialVersionUID = 1L;
	private JTable table;
	private JButton btnback;

	/**
	 * the constructor that  initialize the TardinessReportGuiOutput
	 */
	public TardinessReport_GUI() {
		setLayout(null);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, "total days", "frequency", "standard deviation", "median"},
				{" number of late", null, null, null, null},
				{"late duration", null, null, null, null},
			},
			new String[] {
				"total days", "New column", "New column", "New column", "New column"
			}
		));
		table.getColumnModel().getColumn(0).setPreferredWidth(85);
		table.getColumnModel().getColumn(1).setPreferredWidth(85);
		table.getColumnModel().getColumn(2).setPreferredWidth(85);
		table.getColumnModel().getColumn(3).setPreferredWidth(85);
		table.getColumnModel().getColumn(4).setPreferredWidth(85);
		table.setBounds(10, 189, 608, 48);
		add(table);
		
		JLabel lblNewJgoodiesTitle = DefaultComponentFactory.getInstance().createTitle("            Tardiness report");
		lblNewJgoodiesTitle.setFont(new Font("David", Font.BOLD | Font.ITALIC, 17));
		lblNewJgoodiesTitle.setIcon(new ImageIcon(TardinessReport_GUI.class.getResource("/Picture/Activity-Monitor-System-Monitor-or-Task-Manager-icon.png")));
		lblNewJgoodiesTitle.setBounds(62, 11, 378, 128);
		add(lblNewJgoodiesTitle);
		
		btnback = new JButton("Back");
		btnback.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		btnback.setIcon(new ImageIcon(TardinessReport_GUI.class.getResource("/Picture/go-back-icon.png")));
		btnback.setBounds(10, 420, 135, 47);
		add(btnback);
	}

	/**
	 * 
	 * @return JTable 
	 */
	public JTable getTable() {
		return table;
	}
	/**
	 * 
	 * @param table that set the table for display
	 */
	public void setTable(JTable table) {
		this.table = table;
	}
	/**
	 * 
	 * @return the cancel button
	 */

	public JButton getBtnback() {
		return btnback;
	}

	public void setBtnback(JButton btnback) {
		this.btnback = btnback;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
